****DO FILE TO REPLICATE CHEESEMAN AND PEIFFER: 'Why efforts to fight corruption can undermine the social contract'

*****RENAMING/CODING VARIABLES
rename TrtRand group
label define group 1 "widespread" 2 "relig" 3 "govsuccess" 4 "local" 5 "tax" 6 "control"
label values group group

rename Q30 dutytax
recode dutytax 97=. 98=.

gen dutytax2= 0
recode dutytax2 (0=1) if dutytax==4 | dutytax==5

gen dutytax3 = dutytax
recode dutytax3 (2=1)
recode dutytax3 (3=2)
recode dutytax3 (4=3)
recode dutytax3 (5=3)

rename T_Q36_1 lackfood
recode lackfood 97=. 98=.

rename T_Q36_2 lackwater
recode lackwater 97=. 98=.

rename T_Q36_3 lackmedicine
recode lackmedicine 97=. 98=.

rename T_Q36_4 lackfuel
recode lackfuel 97=. 98=.

rename T_Q36_5 lackcash
recode lackcash 97=. 98=.

rename Q37 dailyincome
recode dailyincome 97=. 98=.

rename Q38 witnesscorrupt
recode witnesscorrupt 97=. 98=.
recode witnesscorrupt (2=0)

gen apc = 0
recode apc (0=1) if Q42==2

gen female = 0
recode female (0=1) if sex==1

gen educ = .
recode educ (.=1) if LSM8==1
recode educ (.=1) if LSM8==9
recode educ (.=2) if LSM8==2
recode educ (.=2) if LSM8==3
recode educ (.=3) if LSM8==4
recode educ (.=4) if LSM8==5
recode educ (.=4) if LSM8==6
recode educ (.=4) if LSM8==7
recode educ (.=4) if LSM8==8
label define educ 1 "not primary" 2 "primary" 3 "secondary" 4 "at least some uni"
label values  educ educ

rename QAG agecat
rename QAA age

gen control=0
gen widespread=0
gen religious=0
gen govsuccess=0
gen localtrt=0
gen tax=0
recode widespread (0=1) if group==1
recode religious  (0=1) if group==2
recode govsuccess (0=1) if group==3
recode localtrt  (0=1) if group==4
recode tax  (0=1) if group==5
recode control (0=1) if group==6

gen treatment = 0
recode treatment (0=1) if widespread==1
recode treatment (0=1) if tax==1
recode treatment (0=1) if govsuccess==1
recode treatment (0=1) if localtrt==1

gen lived_pov = lackfood + lackwater + lackmedicine + lackfuel + lackcash 
replace lived_pov = lived_pov/5

recode T_Q20_10 (98=.)
recode Q29 (98=.)


*********ANALYSES**********

*TABLE 1 ANALYSES
logit dutytax2 i.widespread i.religious i.govsuccess i.localtrt i.tax lived_pov
margins widespread, atmeans
margins religious, atmeans
margins govsuccess, atmeans
margins localtrt, atmeans
margins tax, atmeans

*TABLE 2 ANALYSES
logit dutytax2 widespread religious govsuccess localtrt tax lived_pov
test widespread = govsuccess
test widespread = localtrt
test widespread = tax
test govsuccess = localtrt
test govsuccess = tax
test localtrt = tax

*FOOTNOTE 2: DIM tests
pwmean female, over(group) effects
pwmean age, over(group) effects
pwmean educ, over(group) effects
pwmean lived_pov, over(group) effects

*FOOTNOTE 6: OLOGIT ANALYSES
ologit T_Q20_10 widespread religious govsuccess localtrt tax lived_pov
ologit Q29 widespread religious govsuccess localtrt tax lived_pov

*APPENDIX TABLE C.1 ANALYSES
logit dutytax2 widespread religious govsuccess localtrt tax lived_pov female age educ apc witness 
ologit dutytax widespread religious govsuccess localtrt tax lived_pov
ologit dutytax3 widespread religious govsuccess localtrt tax lived_pov 
logit dutytax2 treatment religious lived_pov

*APPENDIX C2
pwmean dutytax2, over(group) effects



